﻿using MTHHelpers;
using RunModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _8轴运动控制
{
    public class CommendMethods
    {
        public static string SysSetPath { get; set; } = string.Empty;
        public static string PosBasePath { get; set; } = string.Empty;
        public static string strFilePath { get; set; } = string.Empty;

        public static string PlcSetPath { get; set; } = string.Empty;
        //读取系统配置文件
        public static ConfigInfo LogSrtting()
        {
            ConfigInfo config = new ConfigInfo();
            try
            {
                #region 读取配置文件
                config.IP_Adress = Convert.ToString(IniConfigHelper.ReadIniData("系统IP", "IP地址", "", CommendMethods.SysSetPath));
                //运动参数
                config.Unit0 = Convert.ToDouble(IniConfigHelper.ReadIniData("上面相机竖轴0", "脉冲当量", "", CommendMethods.SysSetPath));
                config.VelMin0 = Convert.ToDouble(IniConfigHelper.ReadIniData("上面相机竖轴0", "起始速度", "", CommendMethods.SysSetPath));
                config.VelMax0 = Convert.ToDouble(IniConfigHelper.ReadIniData("上面相机竖轴0", "运行速度", "", CommendMethods.SysSetPath));
                config.Acc0 = Convert.ToDouble(IniConfigHelper.ReadIniData("上面相机竖轴0", "加速度", "", CommendMethods.SysSetPath));
                config.Dec0 = Convert.ToDouble(IniConfigHelper.ReadIniData("上面相机竖轴0", "减速度", "", CommendMethods.SysSetPath));
                config.Sramp0 = Convert.ToDouble(IniConfigHelper.ReadIniData("上面相机竖轴0", "S曲线时间", "", CommendMethods.SysSetPath));

                config.Unit1 = Convert.ToDouble(IniConfigHelper.ReadIniData("上面相机横轴1", "脉冲当量", "", CommendMethods.SysSetPath));
                config.VelMin1 = Convert.ToDouble(IniConfigHelper.ReadIniData("上面相机横轴1", "起始速度", "", CommendMethods.SysSetPath));
                config.VelMax1 = Convert.ToDouble(IniConfigHelper.ReadIniData("上面相机横轴1", "运行速度", "", CommendMethods.SysSetPath));
                config.Acc1 = Convert.ToDouble(IniConfigHelper.ReadIniData("上面相机横轴1", "加速度", "", CommendMethods.SysSetPath));
                config.Dec1 = Convert.ToDouble(IniConfigHelper.ReadIniData("上面相机横轴1", "减速度", "", CommendMethods.SysSetPath));
                config.Sramp1 = Convert.ToDouble(IniConfigHelper.ReadIniData("上面相机横轴1", "S曲线时间", "", CommendMethods.SysSetPath));

                config.Unit2 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机竖轴2", "脉冲当量", "", CommendMethods.SysSetPath));
                config.VelMin2 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机竖轴2", "起始速度", "", CommendMethods.SysSetPath));
                config.VelMax2 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机竖轴2", "运行速度", "", CommendMethods.SysSetPath));
                config.Acc2 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机竖轴2", "加速度", "", CommendMethods.SysSetPath));
                config.Dec2 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机竖轴2", "减速度", "", CommendMethods.SysSetPath));
                config.Sramp2 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机竖轴2", "S曲线时间", "", CommendMethods.SysSetPath));

                config.Unit3 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机横轴3", "脉冲当量", "", CommendMethods.SysSetPath));
                config.VelMin3 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机横轴3", "起始速度", "", CommendMethods.SysSetPath));
                config.VelMax3 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机横轴3", "运行速度", "", CommendMethods.SysSetPath));
                config.Acc3 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机横轴3", "加速度", "", CommendMethods.SysSetPath));
                config.Dec3 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机横轴3", "减速度", "", CommendMethods.SysSetPath));
                config.Sramp3 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机横轴3", "S曲线时间", "", CommendMethods.SysSetPath));

                config.Unit4 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机旋转轴4", "脉冲当量", "", CommendMethods.SysSetPath));
                config.VelMin4 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机旋转轴4", "起始速度", "", CommendMethods.SysSetPath));
                config.VelMax4 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机旋转轴4", "运行速度", "", CommendMethods.SysSetPath));
                config.Acc4 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机旋转轴4", "加速度", "", CommendMethods.SysSetPath));
                config.Dec4 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机旋转轴4", "减速度", "", CommendMethods.SysSetPath));
                config.Sramp4 = Convert.ToDouble(IniConfigHelper.ReadIniData("侧面相机旋转轴4", "S曲线时间", "", CommendMethods.SysSetPath));

                config.Unit5 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘旋转轴5", "脉冲当量", "", CommendMethods.SysSetPath));
                config.VelMin5 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘旋转轴5", "起始速度", "", CommendMethods.SysSetPath));
                config.VelMax5 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘旋转轴5", "运行速度", "", CommendMethods.SysSetPath));
                config.Acc5 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘旋转轴5", "加速度", "", CommendMethods.SysSetPath));
                config.Dec5 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘旋转轴5", "减速度", "", CommendMethods.SysSetPath));
                config.Sramp5 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘旋转轴5", "S曲线时间", "", CommendMethods.SysSetPath));

                config.Unit6 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘上升轴6", "脉冲当量", "", CommendMethods.SysSetPath));
                config.VelMin6 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘上升轴6", "起始速度", "", CommendMethods.SysSetPath));
                config.VelMax6 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘上升轴6", "运行速度", "", CommendMethods.SysSetPath));
                config.Acc6 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘上升轴6", "加速度", "", CommendMethods.SysSetPath));
                config.Dec6 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘上升轴6", "减速度", "", CommendMethods.SysSetPath));
                config.Sramp6 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘上升轴6", "S曲线时间", "", CommendMethods.SysSetPath));

                config.Unit7 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘翻面轴7", "脉冲当量", "", CommendMethods.SysSetPath));
                config.VelMin7 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘翻面轴7", "起始速度", "", CommendMethods.SysSetPath));
                config.VelMax7 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘翻面轴7", "运行速度", "", CommendMethods.SysSetPath));
                config.Acc7 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘翻面轴7", "加速度", "", CommendMethods.SysSetPath));
                config.Dec7 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘翻面轴7", "减速度", "", CommendMethods.SysSetPath));
                config.Sramp7 = Convert.ToDouble(IniConfigHelper.ReadIniData("刹车盘翻面轴7", "S曲线时间", "", CommendMethods.SysSetPath));

                return config;
                #endregion
            }
            catch (Exception)
            {
                return null;
            }



        }


        //创建关闭主窗口的句柄
        public static bool bClose = false;



    }
}
